﻿@model IEnumerable<Classified.Domain.Entities.ClassifiedAd>
          
@using Classified.Service;
@if (Model != null && Model.Count() > 0)
{
<div style="background: none repeat scroll 0 0 #EEEEEE;">
    <h2 align="center">
        Top 3 View
    </h2>
    <table class="table">
        @foreach (var item in Model.Where(x=>x.IsEnhanced))
        {
           
            <tr>
                <td class="table-img">
                    <div class="list-item-pic thumbnail">
                        <a href="@Url.Action("Details", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Title) })">
                            @if (item.ClassifiedPicture.Count == 0)
                            {
                                <img src="/Images/100/80/Images/no-image.jpg" width="100px;" height="80px;" alt="no-image" />
                            }
                            else
                            {
                                <img src="@(String.IsNullOrEmpty(item.ClassifiedPicture.FirstOrDefault().ImageGuid) ? "/Images/100/80/user/no_avatar.jpg" : "/Images/100/80/classified/" + item.ClassifiedPicture.FirstOrDefault().ImageGuid)" alt="@item.Title" title="@item.Title" />


                            }
                        </a>
                        <span class="paid-customer">&nbsp;</span>
                    </div>
                </td>
                <td>
                    <a class="text-info-mid-align pad12" href="@Url.Action("Details", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Title) })">
                        @if (item.Title.Length > 100)
                        {
                            <text>
                            @item.Title.Substring(0, 100)...
                            </text>
                        }
                        else
                        {
                            <text>
                            @item.Title
                            </text>
                        }
                        @if (item.Price > 0)
                        {
                            <br />
                            <span class="price">@SeService.GetCurrentCode(item.Id); @item.Price
                            </span>
                        }</a>
                </td>
            </tr>
        }
        @foreach (var item in Model.Where(x=>x.IsEnhanced == false))
        {
            <tr>
                <td class="table-img">
                     <div class="thumbnail">
                     <a href="@Url.Action("Details", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Title) })">
                         @if (item.ClassifiedPicture.Count == 0)
                         {
                             <img src="/Images/100/80/Images/no-image.jpg" width="100px;" height="80px;" alt="no-image" />
                         }
                         else
                         {
                             <img src="@(String.IsNullOrEmpty(item.ClassifiedPicture.FirstOrDefault().ImageGuid) ? "/Images/100/80/user/no_avatar.jpg" : "/Images/100/80/classified/" + item.ClassifiedPicture.FirstOrDefault().ImageGuid)" alt="@item.Title" title="@item.Title" />


                         }
                     </a>
                     </div>
                </td>
                <td>
                    <a class="text-info-mid-align pad12" href="@Url.Action("Details", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Title) })">
                        @if (item.Title.Length > 100)
                        {
                            <text>
                            @item.Title.Substring(0, 100)...
                            </text>
                        }
                        else
                        {
                            <text>
                            @item.Title
                            </text>
                        }
                        @if (item.Price > 0)
                        {
                            <br />
                            <span class="price"> @SeService.GetCurrentCode(item.Id)
                                @item.Price
                            </span>
                        }</a>
                </td>
            </tr>
        }
    </table>
</div>
}